<template>
	<el-card class="box-card">
	  <div slot="header" class="clearfix">
		<span>添加节点</span>
		<div>在文本框输入内容并点击树的叶子节点，这将模拟异步树加载叶子节点的子节点</div>
	  </div>
	  <div class="text item">
			<el-form label-width="80px">
				<el-form-item label="节点文字">
					
					<!-- 简单粗暴利用$root -->
					<!-- <el-input v-model="$root.nodeText"></el-input> -->
					
					<!-- vuex的方式，但是这样index.js中的vuex需要定义nodeText-->
					<el-input v-model="nodeText"></el-input>
				</el-form-item>
			</el-form>
	  </div>
	</el-card>
</template>
<script>
	export default{
		computed: {
			nodeText: {
				get(){
					return this.$store.state.nodeText;
				},
				set(val){
					this.$store.commit('setNodeText',val);
				}
			}
		}
	}
</script>
